package com.zyit.util;

import lombok.Data;

@Data
public class Result<T> {
    private String code;
    private String msg;
    private T data;
    private int count;

    public static Result ok(){
        return new Result("200");
    }

    public static Result fail(){
        return new Result("500","服务器异常");
    }

    public Result() {
    }

    public Result(String code) {
        this.code = code;
    }

    public Result(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public Result(String code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public Result(String code, String msg, T data, int count) {
        this.code = code;
        this.msg = msg;
        this.data = data;
        this.count = count;
    }
}
